#include<iostream>
#include<signal.h>
#include<unistd.h>
void sigcb(int signum)
{
    std::cout<<"signum: "<<signum<<" "<< getpid()<<std::endl;
}

void printpending(sigset_t& pending)
{
    std::cout<<"pid "<< getpid()<<" ";
    for(int i = 31 ; i >= 1;i--)
    {
        if(sigismember(&pending,i)) std::cout<<1;
        else std::cout<<0;
    }
    std::cout<<std::endl;
}
int main()
{
    int cnt = 5;
    sigset_t block1,oblock;
    sigemptyset(&block1);

    sigaddset(&block1,SIGINT);
    sigaddset(&block1,SIGRTMIN+6);

    int n = sigprocmask(SIG_SETMASK,&block1,&oblock);
    //int m = sigprocmask(SIG_SETMASK,&block2,nullptr);
    
    while(1){
        sigset_t pending;
        sigpending(&pending);
        printpending(pending);
        sleep(1);

    }

    return 0;

}

/*
int main()
{
    //signal(SIGINT,sigcb);
    struct sigaction sa,osa;
    sa.sa_handler = sigcb;
    sa.sa_flags = 0;
    sigemptyset(&sa.sa_mask);
    sigaction(SIGINT,&sa,&osa);
    while(1){}

    return 0;
}

*/



